const path = require('path');
const { paths } = require('../../utils');

module.exports = function (options) {
  let { extensions, alias} = options;
  extensions = [...new Set(extensions)];
  alias = Object.keys(alias).reduce((a, b)=> {
    if(/^\//.test(b)){
      a[b] = alias[b];
    } else {
      a[b] = path.join(paths.contextPath, alias[b]);
    }
    return a;
  },
  {
    '@': path.join(paths.contextPath)
  });
  return {
    extensions,
    alias,
  }
}